<template>
	<view class="energy-detail">
		<view class="flex">
			<span class="c-1">初始读数：</span>
			<span>{{(form.meterCurrent).toFixed(4)}}</span>
		</view>
		<view class="flex">
			<span class="c-1">备注信息：</span>
			<span>{{form.remark}}</span>
		</view>
		<view class="flex1">
			<span class="c-1">附件信息：</span>
			<view class="flex2">
				<image v-for="(item,index) in form.annexFile" @click="previewImage(item)" :key="index" :src="item" class="icon-2" mode=""></image>
			</view>
		</view>
	</view>
</template>
<script setup lang="ts">
	import { onLoad} from "@dcloudio/uni-app"
	import { reactive } from "vue";
	
	const form = reactive({
		meterCurrent: null,
		remark: null,
		annexFile: null
	})
	onLoad((options)=>{
		if(options){
			let info = JSON.parse(decodeURIComponent(options.info))
			console.log(info)
			form.meterCurrent = info.meterCurrent
			form.remark = info.remark
			form.annexFile = info.annexFile
		}
	})
	//预览
	const previewImage = (url) => {
		console.log(url)
		let arr = []
		arr[0] = url
		uni.previewImage({
			urls: arr,
			current:0
		})
	}
</script>
<style lang="scss" scoped>
.energy-detail{
	background: #fff;
	margin-top: 40rpx;
	height: calc(100% - 40rpx);
	padding: 32rpx;
	.flex{
		margin: 8rpx 0;
	}
	.icon{
		width: 160rpx;
		height: 160rpx;
		border-radius: 8rpx;
		margin-right: 20rpx;
	}
	.c-1{
		font-size: 26rpx;
		color: rgba(135, 135, 135, 1);
	}
	.flex2{
		margin-top: 10rpx;
	}
}
</style>